In computer processing, an event is a piece of application-level information from an underlying framework that can occur indeterministically from random stimuli of users or devices and can vary depending on the type of processor or hardware being employed. A particular system hardware design may include a variety of devices, including integrated components that may appear statically or dynamically. A static device generally exists in built-in hardware, while a dynamic device is added and removed through end-user interception. Dynamic devices may include, for example, power management, multimedia applications, speakers, touch screens, flash memory, or Bluetooth™ devices. Both static and dynamic devices serve as sources for asynchronously generating user events that need to be handled by embedded software (e.g., event handlers).
One approach is to use a temporary buffer, such as an event queue, to latch occurred events in order (i.e., First-In-First-Service (FIFS) according to their arrival time) to asynchronously process them later. In a simplest form, without the support of the operating system, a single running program needs to use looping and buffering for event processing. Buffered event data are obtained from either an interrupt service routine or active device polling. The code arrangement within the looping program implies an order of execution. In this case, an event service time is up to the worst case of the loop time.
Another approach includes implementing a multi-threading process, which is a programming and execution model that allows multiple threads of execution to exist within the context of a single process, sharing process resources, but able to execute independently. Threads provide a way for a program to split itself into two or more simultaneously running tasks. In general, multi-threading processes are implemented on an operating system level or within an application. Because threads are often spawned from a main thread (e.g., retrieving data, then displaying the data requires two threads), event handlers that are within an application level often get saturated, and as a result, will undesirably flush an existing event queue.
Accordingly, there exists a need for a system and method capable of prioritizing and repositioning events within a queue such that an event's execution waiting time to meet its response time is decreased without scarifying the expectation of completing other events.